package com.summer.content.api;


import com.summer.content.service.TeachplanMediaService;
import com.summer.dto.BindTeachPlanMediaDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@Slf4j
@RestController
@Api(tags = "课程计划与媒资信息关系API")
public class PlanMediaController {

    @Autowired
    private TeachplanMediaService teachplanMediaService;


    @ApiOperation(value = "课程计划和媒资信息绑定")
    @PostMapping("/teachplan/association/media")
    public void associationMedia(@RequestBody @Validated BindTeachPlanMediaDto bindTeachplanMediaDto){
        teachplanMediaService.associationMedia(bindTeachplanMediaDto);
    }

    @ApiOperation(value = "删除绑定的媒资信息")
    @DeleteMapping("teachplan/association/media/{teachPlanId}/{mediaFileId}")
    public void deleteAssociationMedia(@PathVariable Long teachPlanId, @PathVariable String mediaFileId){
        teachplanMediaService.deleteAssociationMedia(teachPlanId, mediaFileId);
    }
}
